export let comment_hot = {
  namespaced: true,
  state: {
    comment_hot_data: {}
  },
  actions: {
    getCommentHot(store, data = {}) {
      let url = "/comment/hot?id=" + data.id + "&type=" + data.type + "&offset=" + (data.offset - 1) * data.limit + "&limit=" + data.limit + "&timestamp=" + new Date().getTime();
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit('setCommentHot', data);
          resolve(data);
        }).catch((error) => {
          if (error.response) {
            reject(error.response.data);
          }
        });
      });
    }
  },
  mutations: {
    setCommentHot(state, data) {
      state.comment_hot_data = data;
    }
  }
}
